package com.haibei.adapter.bean;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import com.common.bean.IBeanInterface;
import com.common.uitl.Tool;
import com.haibei.net.NetInterface;

/**
 * @author zhanglei
 * @desc 前台用户
 */
public class User implements IBeanInterface {

	private static final long serialVersionUID = -6036966633880337305L;

	public final static int MAN = 1;
	public final static int WOMAN = 2;

	public final static int REAL = 1;
	public final static int VIRTUAL = 2;

	public static Map<Integer, String> SEX_MAPS;
	static {
		SEX_MAPS = new HashMap<Integer, String>();
		SEX_MAPS.put(MAN, "男");
		SEX_MAPS.put(WOMAN, "女");
	}

	private String uid;
	private String username;
	private String password;
	private String nikename;

	private String name;
	// 头像
	private String headPortrait;
	private String sex;
	private Date birthday;
	private String address;
	private String stage;
	private String postCode;
	private String mobilePhone;
	private String qq;
	// 用户类型：真实用户=1; 虚拟用户=2(默认为真是用户)
	private String type;

	public String getUid() {
		return uid;
	}

	public void setUid(String uid) {
		this.uid = uid;
	}

	public String getSexDesc() {
		return SEX_MAPS.get(Integer.parseInt(this.sex));
	}

	public Date getBirthday() {
		return birthday;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getPostCode() {
		return postCode;
	}

	public void setPostCode(String postCode) {
		this.postCode = postCode;
	}

	public String getMobilePhone() {
		return mobilePhone;
	}

	public void setMobilePhone(String mobilePhone) {
		this.mobilePhone = mobilePhone;
	}

	public String getQq() {
		return qq;
	}

	public void setQq(String qq) {
		this.qq = qq;
	}

	public String getNikename() {
		return nikename;
	}

	public void setNikename(String nikename) {
		this.nikename = nikename;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getHeadPortrait() {
		return headPortrait;
	}

	public void setHeadPortrait(String headPortrait) {
		if (Tool.isImgUrl(headPortrait) && !headPortrait.startsWith("http")) {
			this.headPortrait = NetInterface.warpImgUrl(headPortrait);
		} else {
			this.headPortrait = headPortrait;
		}
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public String getStage() {
		return stage;
	}

	public void setStage(String stage) {
		this.stage = stage;
	}

	// 预备期:p
	// 准爸妈:w
	// 育儿阶段:i
	public static String getStageText(String text) {
		if ("p".equalsIgnoreCase(text)) {
			return "预备期";
		}
		if ("w".equalsIgnoreCase(text)) {
			return "准爸妈";
		}
		if ("i".equalsIgnoreCase(text)) {
			return "育儿阶段";
		}
		return null;
	}
}
